# -*- coding:utf-8 -*-
class Solution:
    def __init__(self):
        self.stack = []
        self.minstack = []

    def push(self, node):
        # write code here
        self.stack.append(node)
        if len(self.minstack) == 0 or node < self.min():
            self.minstack.append(node)
        else:
            tmp = self.min()
            self.minstack.append(tmp)

    def pop(self):
        # write code here
        if self.stack == [] or self.minstack == []:
            return None
        self.stack.pop()
        self.minstack.pop()

    def top(self):
        # write code here
        return self.stack[-1]

    def min(self):
        # write code here
        return self.minstack[-1]